package com.bsoft.exchange.dao.his;

import com.bsoft.exchange.domain.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author chenhf
 *
 */
@Mapper
public interface ClinicMedicationMapper {
	

    /**
     * 获取药房药品信息
     * @param jgid 机构id
     * @param pydm 拼音右模糊查询
     * @param yfsb 药房识别
     * @param yplx 药品类型 1：西药2：中成药3：中草药
     * @return
     */
    public List<DrugInfoDomain> syncDrugInformation(@Param("jgid")Long jgid,@Param("pydm")String pydm,
    		@Param("yfsb")Integer yfsb,@Param("yplx")Integer yplx);


    /**
     * 根据药品序号获取药品权限
     * @param ypxh
     * @return
     */
    public List<Map<String, Object>> getYpqx(@Param("ypxh")Long ypxh);

    /**
     * 获取诊断信息
     * @param jgid 机构id
     * @param pydm 拼音右模糊查询
     * @param jblx 疾病类型 1：西医2：中医 diagnosticType
     * @return
     */
    public List<DiagnosticInfoDomain> syncDiagnosticInformation(@Param("jgid")Long jgid,@Param("pydm")String pydm,
    		@Param("jblx")Integer jblx);


    public DiagnosticInfoDomain getDiagnoseformation(@Param("jbxh")Long jbxh,@Param("jblx")Integer jblx);
    
    /**获取预约信息
     * @param jgid 机构id
     * @param ghxh 病人id
     * @return
     */
    public Map<String, Object> getAppointmentInfo(@Param("jgid")Long jgid,@Param("ghxh") Long ghxh);
    
    /**
     * 获取有效就诊记录
     * @param jgid 机构id
     * @param brid 病人id
     * @param ksdm 科室代码
     * @param ysdm 医生代码
     * @param ghxh 挂号序号
     * @param beginDate 有效时间
     * @return
     */
    public YS_MZ_JZLSDomain getClinicHistory(@Param("jgid")Long jgid,@Param("brid") Long brid,
    		@Param("ksdm") Long ksdm,@Param("ysdm") String ysdm,@Param("ghxh") Long ghxh,@Param("beginDate") Date beginDate
    		);
    
    /**
     * 获取就诊记录
     * @param jzxh 
     * @return
     */
    public YS_MZ_JZLSDomain getClinicHistoryById(@Param("jzxh")Long jzxh);
    
    /**保存就诊记录
     * @param clinicHistory
     */
    public void saveClinicHistory(YS_MZ_JZLSDomain clinicHistory);
    
    
    /**保存门诊疾病诊断
     * @param diagnose
     */
    public void saveDiagnose(YS_MZ_JBZDDomain diagnose);
    
    public void deleteDiagnose(@Param("jgid")Long jgid,@Param("jzxh") Long jzxh);
    
    /**保存门诊处方01
     * @param 
     */
    public void saveCf01(MS_CF01Domain cf01);
    
    
    /**保存门诊处方02
     * @param 
     */
    public void saveCf02(MS_CF02Domain cf02);
    
    public void deleteCf02(@Param("jgid")Long jgid,@Param("cfsb") Long cfsb);
    public void deleteCf01(@Param("jgid")Long jgid,@Param("cfsb") Long cfsb);
    
    
    /**
     * 获取cf01
     * @param cfsb 
     * @return
     */
    public MS_CF01Domain getMS_CF01ById(@Param("cfsb")Long cfsb);
    
    /**根据频次编码获取频次
     * @param pcbm
     * @return
     */
    public List<GY_SYPCDomain> getSypc(@Param("jgid")Long jgid,@Param("pcbm")String pcbm);
    
    /**根据频次编码获取执行周期
     * @param jgid
     * @param pcbm
     * @return
     */
    public List<GY_ZXZQDomain> getZxzq(@Param("jgid")Long jgid,@Param("pcbm")String pcbm); 
    
    
    /**根据药品序号和药品产地获取药品信息
     * @param jgid
     * @param yfsb
     * @param ypxh
     * @param ypcd
     * @return
     */
    public DrugInformationDomain getDrugInformation(@Param("jgid")Long jgid,@Param("yfsb") Long yfsb,
    		@Param("ypxh")Long ypxh,@Param("ypcd") Long ypcd);
    
    /**根据机构id和就诊序号获取门诊诊断列表
     * @param jgid
     * @param jzxh
     * @return
     */
    public List<GetDiagInfoDomain> getDiagnoseInformation(@Param("jgid")Long jgid,@Param("jzxh") Long jzxh);
    
    
    /**根据机构id和就诊序号获取门诊处方列表
     * @param jgid
     * @param jzxh
     * @return
     */
    public List<GetPrescriptionInformationDomain> getPrescriptionInformation(@Param("jgid")Long jgid,@Param("jzxh") Long jzxh);
    
    
    /**获取药品用法
     * @param jgid
     * @return
     */
    public List<DrugUsageDomain> getDrugUsage(@Param("jgid")Long jgid);
    
    /**获取药品频次
     * @param jgid
     * @return
     */
    public List<DrugFrequencyDomain> getDrugFrequency(@Param("jgid")Long jgid);
    
    /**
     * 更新就诊记录状态
     */
    public void updateClinicHistory(YS_MZ_JZLSDomain clinicHistory);
    
    
    /**
     * 更新挂号明细就诊状态
     * @param sbxh
     * @param jzzt
     */
    public void updateRegistration(@Param("sbxh") Long sbxh,@Param("jzzt")Long jzzt);
    
    public List<ClinicRecordDomain> getClinicRecordList(@Param("jgid")Long jgid,@Param("jzxh")Long jzxh,@Param("brid")Long brid);
    
    public void saveClinicRecord(ClinicRecordDomain omr_bl01);
    
    public void updateClinicRecord(ClinicRecordDomain omr_bl01);
    
    public List<GetMedicalRecordInformationDomain> getClinicMedicalRecordList(@Param("jgid")Long jgid,@Param("jzxh")Long jzxh);
    
    /**获取门诊病历签名记录
	 * @param blbh
	 * @return
	 */
	public List<RecordSignDomain> getClinicSignList(@Param("blbh")Long blbh);

	/**根据病历编号获取病历内容
	 * @param blbh
	 * @return
	 */
	public RecordDomain getClinicRecordById(@Param("blbh")Long blbh);
	
	/**获取门诊页眉页脚
	 * @return
	 */
	public RecordDomain getClinicHead(@Param("jzxh")Long jzxh);
	
	/**获取病人门诊病程记录
	 * @return
	 */
	public List<RecordDomain> getClinicCourseList(@Param("jzxh")Long jzxh);
	
	/**获取药品煎法，不分机构，带上jgid 是为了预留，项目上直接改xmlsql语句即可
	 * @param jgid
	 * @return
	 */
	public List<GetDrugDecoctionDomain> getDrugDecoction(@Param("jgid")Long jgid);
    /**
     * 根据门诊号码获取brid
     */
    List<PrescriptionAuditInformation> mzhmGetbridInfo(@Param("jgid")String jgid,@Param("mzhm")String mzhm,
                                                       @Param("sfzh")String sfzh,@Param("kssj")String kssj,
                                                       @Param("jssj")String jssj);
    /**
     * 获取处方审核信息
     */
    List<PrescriptionAuditInformationList>getCfAduitInfo(@Param("jgid")String jgid, @Param("brid")String brid,@Param("sfjg")Integer sfjg);
    /**
     * 获取门诊记录
     */
    List<HealthRecordsDomain>getMzHealthRecords(@Param("jgid")String jgid,@Param("brid")String brid);
    /**
     * 获取住院记录
     */
    List<HealthRecordsDomain>getZyHealthRecords(@Param("jgid")String jgid,@Param("brid")String brid);
}
